package com.yixun.qfbao.job;

import com.yixun.qfbao.api.service.JobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 交易超时: 到访后为及时认筹、认购或认筹后未及时认购、认购后未及时签约的报备
 * 操作说明: 将上述报备记录置位无效
 */
@Component
public class OverTradeTimeJob {
	private static Logger logger = LoggerFactory.getLogger(OverTradeTimeJob.class);
	
	@Autowired
	private JobService jobService;

	@Scheduled(cron = "0 0/10 * * * ?")
	public void overReportedTime() {
		logger.info("客户到访后、认筹、认购、签约,判断生效日期是否大于流程等待时间(带看保护时间)....job start");
		int customerStatus = jobService.overTradeTimeJob();
		if(customerStatus == 1){
			logger.info("客户报备状态更新成功..........");
		}
		logger.info("客户到访后、认筹、认购、签约,判断生效日期是否大于流程等待时间.....job end");
	}
}
